class WelcomeController < ApplicationController
  	before_filter :login_required
  	layout "framework",:except=>[:build_menu]
  	def index
  		conditions = nil
  		#==============判断未付款订单数量===============================
  		if @session[:account].role.memo.include? 'salemanager'
  			conditions = "charge='no' and papertype<>'CA'"
  		else
  			conditions = "charge='no' and papertype<>'CA' and employee_id=#{@session[:account].employee.id}"
  		end
  		@paperCount = SalePaper.count(conditions)
  		#==============判断销售管理者消息通知=============================
  		conditions = "employee_id=#{@session[:account].employee.id} and checked=0"
  		@messageCount = Message.count(conditions)
  	end
  
  	def top
  	end
  	def left
  	end
  	def menu
  	end
  	def bottom
  	end
 	
    def list_messages
    	@messages = Message.find(:all,:conditions=>"employee_id=#{@session[:account].employee.id} and checked=0",:order=>'create_date_at DESC')
    end
    
    def check_message
    	Message.delete(params[:id])
    	redirect_to :action => "list_messages"
    end
end
